//    Copyright (C) 2013  <lugocreation@gmail.com>
//
//    This program is free software: you can redistribute it and/or modify
//    it under the terms of the GNU General Public License as published by
//    the Free Software Foundation, either version 3 of the License, or
//    (at your option) any later version.
//
//    This program is distributed in the hope that it will be useful,
//    but WITHOUT ANY WARRANTY; without even the implied warranty of
//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//    GNU General Public License for more details.
//
//    You should have received a copy of the GNU General Public License
//    along with this program.  If not, see <http://www.gnu.org/licenses/>.
package org.jpgolay.me.stock;

import java.awt.Font;
import javax.swing.JMenuItem;
import javax.swing.JPopupMenu;

public class PopupStockGUI extends JPopupMenu {

    public PopupStockGUI() {
        closeMI = null;
        closeAllMI = null;
        initialize();
    }

    public PopupStockGUI(String label) {
        super(label);
        closeMI = null;
        closeAllMI = null;
    }

    private void initialize() {
        add(getCloseMI());
        add(getCloseAllMI());
    }

    private JMenuItem getCloseMI() {
        if (closeMI == null) {
            closeMI = new JMenuItem();
            closeMI.setText("Fermer");
            closeMI.setFont(new Font("Tahoma", 1, 10));
        }
        return closeMI;
    }

    private JMenuItem getCloseAllMI() {
        if (closeAllMI == null) {
            closeAllMI = new JMenuItem();
            closeAllMI.setText("Fermer tout");
            closeAllMI.setFont(new Font("Tahoma", 1, 10));
        }
        return closeAllMI;
    }

    public JMenuItem getClose() {
        return getCloseMI();
    }

    public JMenuItem getCloseAll() {
        return getCloseAllMI();
    }
    private JMenuItem closeMI;
    private JMenuItem closeAllMI;
}
